package com.soft.util;

import java.util.Map;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.soft.mapping.User;

/**
 * 登陆拦截器
 * 
 */
public class LogionInterceptor extends MethodFilterInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		Map map = invocation.getInvocationContext().getSession();
		User user = (User) map.get("user");
		// System.out.println("----------------------" + user);
		if (user == null || user.toString().trim().equals("null")) {
			return "error";
		} else {
		}
		return invocation.invoke();
	}
}
